package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zr.service.UpdateScopeService;
@Controller
@Scope(value="prototype")
public class UpdateScopeAction implements ServletResponseAware{
	private Integer disid;
	private String disscope;
	private Double disprice;
	
	
	public Integer getDisid() {
		return disid;
	}

	public void setDisid(Integer disid) {
		this.disid = disid;
	}

	public String getDisscope() {
		return disscope;
	}

	public void setDisscope(String disscope) {
		this.disscope = disscope;
	}

	public Double getDisprice() {
		return disprice;
	}

	public void setDisprice(Double disprice) {
		this.disprice = disprice;
	}
	private HttpServletResponse resp;
	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		this.resp=arg0;
	}
	@Resource
	private UpdateScopeService updscoseri;
	
    public void updateScope(){		
		resp.setCharacterEncoding("utf8");
		updscoseri.updateScope(disid, disscope, disprice);
		try {
			PrintWriter pw=resp.getWriter();
			pw.write("1");
			pw.flush();
			pw.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
